package com.nidu.demo.config.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nidu.demo.config.mapper.dataobject.ConfigDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 系统配置Mapper接口
 *
 * @author auto
 */
@Mapper
public interface ConfigMapper extends BaseMapper<ConfigDO> {

    @Select("SELECT * FROM sys_config WHERE `key` = #{key} LIMIT 1")
    ConfigDO selectByKey(String key);

    @Select("SELECT * FROM sys_config WHERE name LIKE CONCAT('%', #{name}, '%') ORDER BY create_time DESC")
    List<ConfigDO> selectByNameLike(String name);

    @Select("SELECT * FROM sys_config WHERE status = #{status} ORDER BY create_time DESC")
    List<ConfigDO> selectByStatus(Integer status);
} 